public class MyQuickSort {
    public void quickSort(int[] array) {
        int right = array.length - 1;
        int left = 0;
        quick(array,left,right);
    }
    private void quick(int[] array,int left,int right) {
        if(left >= right) {
            return;
        }
        int cmd = mySort(array,left,right);
        quick(array,cmd + 1,right);
        quick(array,left,right-1);

    }
    private int mySort(int[] array,int left,int right) {
        int tmp = array[left];
        while(left < right) {
            while(left < right && array[right] >= tmp) {
                right--;
            }
            array[left] = array[right];
            while(left < right && array[left] <= tmp) {
                left++;
            }
            array[right] = array[left];
        }
        array[left] = tmp;
        return left;
    }

}
